/**
 * Created by wz .
 * description:
 **/
import {HTTP} from '../util/http'

class Welfare extends HTTP {
    getRedPacket(params = {}, success) {
        let url = 'redPacket'
        let data = params
        this.request({
            url: url,
            data: data,
            success
        })
    }

    getRedPacketDetail(params = {}, success) {
        let url = 'redPacket/detail'
        let data = Object.assign({},
            params,
            {
                userId: wx.getStorageSync('userInfo').user_id || 0
            }
        )
        this.request({
            url: url,
            data: data,
            success
        })
    }

    getRedPacketReceive(params = {}, success,fail){
        let url = 'redPacket/receive'
        let data = Object.assign({},
            params,
            {
                userId: wx.getStorageSync('userInfo').user_id || 0
            }
        )
        this.request({
            url: url,
            data: data,
            success,
            fail
        })
    }

    /*
    * data为post中的参数  UrlData为post请求中在url中的参数
    * */
    getRedPacketSend(params = {}, urlData = {}, success, fail) {
        let url = 'redPacket/send'
        let data = Object.assign({}, params, {})
        this.request({
            url: url,
            method: 'POST',
            data: data,
            urlData: urlData,
            success,
            fail
        })
    }

}

export {Welfare}